package org.bigdata.framework.admin.web.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class JudgeDate {
    
    //判断范围时间
    public static String dateJudge(String start, String end,String newDate) throws Exception {
        String judge = "yes";
        SimpleDateFormat localTime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date sdate = localTime.parse(start);
        Date edate=localTime.parse(end);
        Date date=localTime.parse(newDate);
        if(date.after(sdate)&& date.before(edate)){
            judge = "no";
        }
        return judge;
    }
    //判断大于当前时间
    public static String timeJudge(String start,String end) throws Exception {
        String judge = "yes";
        SimpleDateFormat localTime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date sdate = localTime.parse(start);
        Date edate=localTime.parse(end);
        if(edate.before(sdate)){
            judge = "no";
        }
        return judge;
    }
    public static void main(String[] args) throws Exception {
       // String j = JudgeDate.timeJudge("2017-07-19 10:41:38","2017-07-20 10:41:4");
        String j=JudgeDate.dateJudge("2017-07-19 10:41:38", "2017-08-02 10:12:50", "2017-06-20 10:13:49");
        System.out.println(j);
    }   
}
